package product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import product.dto.SportsDto;

import java.util.List;

public interface SportsMapper extends BaseMapper<SportsDto> {
    @Insert("INSERT INTO Sports (user_id, username, lastWorkoutDate, totalWorkouts, totalCaloriesBurned) " +
            "VALUES (#{userId}, #{username}, #{lastWorkoutDate}, #{totalWorkouts}, #{totalCaloriesBurned})")
    @Options(useGeneratedKeys = true)
    void insertSports(SportsDto sportsDto);

    @Delete("DELETE FROM Sports WHERE username = #{username} AND lastWorkoutDate = #{lastWorkoutDate} AND totalWorkouts = #{totalWorkouts} AND totalCaloriesBurned = #{totalCaloriesBurned}")
    void deleteSports(SportsDto sportsDto);

}
